#coding=utf-8
#此程序为获取到headers和cookies
from selenium import webdriver
import json
from collections import OrderedDict
import time
from selenium.webdriver.chrome.options import Options

#获取headers+cookies
def login_headers(url,keywords,password):
    driver = webdriver.Chrome()
    # 获取与组合保存cookie
    # 获取cookie列表
    cookie = [item["name"] + "=" + item["value"] for item in driver.get_cookies()]
    cookiestr = ';'.join(item for item in cookie)
    cookiestr = cookiestr.encode('utf-8')
    cookies = dict([l.split("=", 1) for l in cookiestr.split("; ")])
    print cookies
    return cookies


if __name__ == '__main__':
    login_headers('http://www.yipaiwang.co','17700010001','cq123321')